<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}


$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/tagcloud.tpl");

$tagtotal = 0;
$tagtotalcount = mysql_query("SELECT * FROM affiliSt_cloud WHERE approve = '1' ORDER BY searchPhrase ASC");
$tagrow = mysql_fetch_array($tagtotalcount);
	do {
	$tagtotal = $tagtotal + $tagrow['searchPhraseCount'];
	} while ($tagrow = mysql_fetch_array($tagtotalcount));


                        




$listsearchphrases = mysql_query("SELECT * FROM affiliSt_cloud ORDER BY SearchPhraseID ASC");
$tagrow = mysql_fetch_array($listsearchphrases);
do {
	if ($tagrow['approve'] == 1) {
	
	$visits = $tagrow['searchPhraseCount'];
	$perc = round($visits / $tagtotal,3); // caluclate percentage for each city
		if			($perc < 0.05) { $size=11; $color='#999999'; $lineheight='130%'; } // SMALLEST TEXT SIZE
		else if		($perc < 0.1) { $size=14; $color='#777777'; $lineheight='130%'; } 
		else if		($perc < 0.15) { $size=17; $color='#555555'; $lineheight='130%'; } 
		else if		($perc < 0.20) { $size=20; $color='#333333'; $lineheight='130%'; } 
		else if		($perc < 0.25) { $size=23; $color='#111111'; $lineheight='130%'; } 
		else 		{ $size=26; $color='#000000'; $lineheight='130%'; } // BIGGEST TEXT SIZE
	
					$box_content->assign("TAGLINKS",'<a href="'.$installDir['value'].'index.php?case=search&ps='.str_replace("-", "+", $tagrow['searchPhrase']).'" style="font-size:'.$size.'px;color:'.$color.';line-height:'.$lineheight.'">'. str_replace("-", "&nbsp;", $tagrow['searchPhrase']).'</a> ');
					$box_content->parse("tagcloud.tag");
	}
} while ($tagrow = mysql_fetch_array($listsearchphrases));





$box_content->assign("DATA", "Popular Searches");

$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse("tagcloud");
$box_content = $box_content->text("tagcloud");
?>